package com.wzx.ptplatform.controller;

import com.wzx.ptplatform.service.PartTimeMessageService;
import com.wzx.ptplatform.utils.ConstUtils;
import io.swagger.annotations.Api;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author wzx
 */
@Api(tags = "主页首页模块")
@RestController
public class IndexController {

    final PartTimeMessageService partTimeMessageService;

    public IndexController(PartTimeMessageService partTimeMessageService) {
        this.partTimeMessageService = partTimeMessageService;
    }

    @GetMapping("index")
    public ModelAndView index() {
        return new ModelAndView("index");
    }

    @GetMapping("range")
    public ModelAndView range(Model model) {
        model.addAttribute("partTimeMessageListReady", partTimeMessageService.findByPostStatus(ConstUtils.POST_STATUS_READY));
        return new ModelAndView("range");
    }
}
